package com.stockz.equity.charting.model;


public class Line implements Shape {

	private Point start;
	private Point end;
	private boolean visible = true;
	
	public Line(){
		this(new Point(),new Point());
	}
	
	public Line(Point start, Point end){
		this(start,end,true);
	}
	
	public Line(Point start, Point end, boolean visible) {
		super();
		this.start = start;
		this.end = end;
		this.visible = visible;
	}

	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Line){
			Line line = (Line)obj;
			return line != null 
			&& line.getStart() != null 
			&& line.getEnd() != null 
			&& line.getStart().equals(getStart())
			&& line.getEnd().equals(getEnd());
			
		}else
			return false;
	}
	
	@Override
	public int hashCode() {
		return (String.valueOf(getStart().hashCode())+String.valueOf(getEnd().hashCode())).hashCode();
	}
	
	@Override
	public String toString() {
		return "Line - ["+start == null?"null":start.toString()+", "+end == null?"null":end.toString()+"]";
	}
	
	
	public Point getStart() {
		return start;
	}
	public void setStart(Point start) {
		this.start = start;
	}
	public Point getEnd() {
		return end;
	}
	public void setEnd(Point end) {
		this.end = end;
	}

	public boolean isVisible() {
		return visible;
	}

	public void setVisible(boolean visible) {
		this.visible = visible;
	}
	
	
}
